-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here

-- vim.o.shell = "/usr/bin/zsh"
vim.o.shell = "/usr/bin/fish"

-- vim.g.root_spec = { "cwd" }
vim.g.neovide_theme = "catppuccin"
vim.g.autoformat = false

if vim.g.neovide then
  -- terminal color config
  vim.g.terminal_color_0 = "#414868"
  vim.g.terminal_color_1 = "#F7768E"
  vim.g.terminal_color_2 = "#9ECE6A"
  vim.g.terminal_color_3 = "#E0AF68"
  vim.g.terminal_color_4 = "#7AA2F7"
  vim.g.terminal_color_5 = "#BB9AF7"
  vim.g.terminal_color_6 = "#7DCFFF"
  vim.g.terminal_color_7 = "#A9B1D6"
  vim.g.terminal_color_8 = "#414868"
  vim.g.terminal_color_9 = "#F7768E"
  vim.g.terminal_color_10 = "#9ECE6A"
  vim.g.terminal_color_11 = "#E0AF68"
  vim.g.terminal_color_12 = "#7AA2F7"
  vim.g.terminal_color_13 = "#BB9AF7"
  vim.g.terminal_color_14 = "#7DCFFF"
  vim.g.terminal_color_15 = "#C0CAF5"

  -- pasting
  vim.keymap.set("n", "<c-v>", '"+P') -- Paste normal mode
  vim.keymap.set("v", "<c-v>", '"+P') -- Paste visual mode
  vim.keymap.set("c", "<c-v>", "<C-R>+") -- Paste command mode
  vim.keymap.set("i", "<c-v>", '<esc>"+pa') -- Paste insert mode

  -- cursor animation
  vim.g.neovide_cursor_animation_length = 0.08
  vim.g.neovide_cursor_trail_size = 0.2

  -- display
  -- vim.o.guifont = "CaskaydiaCove Nerd Font:h12"
  -- vim.o.guifont = "DMMono Nerd Font:h12"
  -- vim.o.guifont = "Consolas:h12"
  -- vim.o.guifont = "JetBrainsMono Nerd Font:h12"
  vim.o.guifont = "Maple Mono NF CN:h12"

  -- dynamic scale
  vim.g.neovide_scale_factor = 1.0
  -- vim.g.neovide_scale_factor = 1.5
  local change_scale_factor = function(delta)
    vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta
  end
  vim.keymap.set("n", "<C-=>", function()
    change_scale_factor(1.1)
  end)
  vim.keymap.set("n", "<C-->", function()
    change_scale_factor(1 / 1.1)
  end)

  -- linespacing
  vim.opt.linespace = 4
end
